<template>
	<view class="Informationreminder">
		<view class="order_title" >
			<view class="title_left">
				新增粉丝声音提醒
			</view>
			<view class="title_right">
				 <switch :checked="ht.fans_voice==1" @change="switch1Change" />
			</view>
		</view>
		<view class="order_title" >
			<view class="title_left">
				佣金到账提醒
			</view>
			<view class="title_right">
				 <switch :checked="ht.commission_voice==1" @change="switch1Change1" />
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				access_token:'',
				ht:''
			};
		},
		onShow() {
			if(uni.getStorageSync('access_token')){
			this.access_token=JSON.parse(uni.getStorageSync('access_token'))
			}
			let _this=this
			this.$request('/app/setting/getMessageVoice', 'post', {
				page: this.page,
				access_token:this.access_token
			}).then(res => {
				_this.ht=res.content
				console.log(_this.ht)
			})
		},
		methods:{
			switch1Change: function (e) {
				this.$request('/app/setting/changeVoice', 'post', {
					page: this.page,
					access_token:this.access_token,
					type:'1'
				}).then(res => {
					console.log(res)
					uni.showToast({
						title:res.message,
						duration:2000,
						icon:'none'
					})
				})
			},
			switch1Change1: function (e) {
				this.$request('/app/setting/changeVoice', 'post', {
					page: this.page,
					access_token:this.access_token,
					type:'2'
				}).then(res => {
					console.log(res)
					uni.showToast({
						title:res.message,
						duration:2000,
						icon:'none'
					})
				})
			},
		}
	}
</script>

<style lang="less">
	.Informationreminder{
		height: 100%;
		.order_title{
			display: flex;
			justify-content: space-between;
			padding: 20rpx 40rpx;
			border-bottom:1px solid #EEEEEE;
			align-items: center;
			background-color: #fff;
			.title_left{
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #111111;
			}
			.title_right{
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #9DA5A8;
			}
		}
	}
</style>
